/*******************************************************************************
 * Copyright (c) 2008 Sylvain Sicard.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser Public License v2.1
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * 
 * Contributors:
 *     Sylvain Sicard - initial API and implementation
 ******************************************************************************/
/*
 * Created on 6 mai 2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package fr.jade.util;

import java.util.Set;
import java.util.Vector;

/**
 * @author Sylvain Sicard
 *
 */
public class CollectionUtil {
	
	public static Vector<Object> objectArray2Vector(Object[] array){
		Vector<Object> v = new Vector<Object>();
		for(int i=0; i<array.length; i++){
			v.add(array[i]);
		}
		return v;
	}
	
	public static Object checkAndGetSingleton(Set<?> set){
	  assert set.size() ==1 : "Set must contain exactly one element";
	  return set.iterator().next();
	}
}
